package org.wx.thread.jol;

import lombok.extern.slf4j.Slf4j;
import org.openjdk.jol.info.ClassLayout;


/**
 * @description: synchronized 偏向锁重入
 * @author: wangxun
 * @createDate: 2021/4/15
 * @version: 1.0
 */
@Slf4j
public class SyncReentryLockTest {
    public static void main(String[] args) {
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        final Object o = new Object();
        log.info("初始化的object:{}", ClassLayout.parseInstance(o).toPrintable());

        synchronized (o){
            log.info("加锁的object:{}",ClassLayout.parseInstance(o).toPrintable());
            synchronized (o){
                log.info("加锁的object:{}",ClassLayout.parseInstance(o).toPrintable());
            }
        }

    }
}
